FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 11244
EXPOSE 44335

FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY ["MicroService/PayService/PayService.csproj", "MicroService/PayService/"]
RUN dotnet restore "MicroService/PayService/PayService.csproj"
COPY . .
WORKDIR "/src/MicroService/PayService"
RUN dotnet build "PayService.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "PayService.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "PayService.dll"]